<template>
    <div class="section-wrap">
        <!-- 头部 -->
         <div class="headerBox">
        <div class="header">
            <x-icon type="ios-arrow-left" size="" class="icon-white" @click="goBack"></x-icon>待审批考核计划
        </div>
        </div>
        <div class="form-section" style="margin-top: 40px;">
            <div class="project_div">
                <ul class="project_list">
                    <li @click="$router.push({path:'/planEnter',query:{id:item.id,allowApproval:item.allowApproval}})" v-for="(item,index) in resultlist" :key="index">
                        <h4>{{item.beDepartName}}</h4>
                        <p><span>{{item.classifyTwoName}}</span><span class="project_time">{{item.checkDate.substring(0, 10)}}</span></p>
                        <x-icon type="ios-arrow-right" size="22" class="icon-right"></x-icon>
                    </li>
                    <li v-if="resultlist.length==0" style="text-align:center;border:none;padding-top:40px;font-size:18px;">暂无数据</li>
                </ul>
            </div>
        </div>
    </div>
</template>
<script>
  import formatDate from "../../utils/formatDate";
export default {
  data() {
    return {
      isDisabled: true, // 是否禁止输入
      detailData: {
        ResolveStartTime: "2019-07-01",
        ResolveEndTime: "2019-08-29",
        DeptName1: "全部",
        DeptName2: "北京华电豆粒有限公司"
      },
      resultlist: [],
      params: {
        // startDate: new Date().getFullYear() + "-01-01",
        // endDate: formatDate(new Date(), "yyyy-MM-dd"),
        // checkDepartId: "",
        //parentId: 0,
        // status:1,
        IsGetAll:0
      }
    };
  },
  components: {},
  created() {
    this.getAssessmentPlan();
  },
  mounted(){
        let that = this;
        this.$bridge.registerHandler("setToken", function(data) {
                         that.$store.state.Authorization =
          "Bearer " + data;
          that.getAssessmentPlan();
            //这里data ioS返回的是token值(字符串)
        });

        this.connectWebViewJavascriptBridge(function(bridge) { 
            bridge.registerHandler("setToken", function(data) {
                             that.$store.state.Authorization =
          "Bearer " + data;
           that.getAssessmentPlan();
                  //这里data android返回的是token值(字符串)
                
            });
        });
    },
  methods: {
    connectWebViewJavascriptBridge(callback) {
            if (window.WebViewJavascriptBridge) {
                callback(WebViewJavascriptBridge);
            } else {
                document.addEventListener(
                "WebViewJavascriptBridgeReady",
                function() {
                    callback(WebViewJavascriptBridge);
                },
                false
                );
            }
        },  
    getAssessmentPlan() {
      // this.params.checkDepartId = this.$store.state.departId
      this.$axiosAjax
        .AppGetPageListAll(this.params)
        .then(res => {
          if (res.data.success == true) {
           
            this.resultlist = res.data.result.items;
          }
        })
        .catch(err => {});
    },
    goBack() {
      this.$bridge.callHandler({
              type: 'closePage',
              data: {}
            });
    }
  }
};
</script>
<style lang="less" scoped>
.project_div {
  .project_list {
    padding-left: 20px;
    li {
      border-bottom: 1px solid #efeff4;
      height: 77px;
      position: relative;
      padding-top: 18px;
      padding-right: 22px;
      h4 {
        width: calc(100% - 40px);
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
        font-size: 16px;
        margin-bottom: 8px;
        font-weight: bold;
      }
      p {
        span {
          font-size: 14px;
          color: #666;
        }
        span:first-child {
          margin-right: 40px;
        }
      }
      .project_status {
        margin-top: 14px;
        strong {
          font-size: 12px;
        }
        strong.project_status1 {
          color: #ff7333;
        }
        strong.project_status2 {
          color: #469b7a;
        }
      }
      .vux-x-icon {
        fill: #999;
        right: 20px;
        top: 50%;
        margin-top: -11px;
        position: absolute;
      }
    }
  }
}
</style>
